-
Notifications
You must be signed in to change notification settings - Fork 192
To support jdk 16, add converters and module-info. #1167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
41981bc
to
e77d0a3
Compare
For the time being, we cannot include this change as projects are required to remain Java 8-compatible. Setting the release version to Furthermore, we do not plan to add module descriptors across Spring projects. Once we agree to do so, we will have to make sure to come up with a consistent design for all modules. |
…se into datacouch_1057_illegal_reflective_access
Mark - I've removed target 9 and the module-info.java. So this just has the added converters and related changes and it does run with jdk 16 without errors. |
Sounds good. Care to squash all commits into one? |
this.setCustomConversions(customConversions); | ||
// if the mappingContext does not have the SimpleTypes, it will not know that they have converters, then it will | ||
// try to access the fields of the type and (maybe) fail with InaccessibleObjectException | ||
((CouchbaseMappingContext) mappingContext).setSimpleTypeHolder(customConversions.getSimpleTypeHolder()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this would work, associating custom conversions should happen outside the converter. Typically, CustomConversions
gets configured by users, and then it should get associated with the converter/mapping context within @Bean
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were already populated in AbstractCouchbaseConverter.
protected CustomConversions conversions = new CouchbaseCustomConversions(Collections.emptyList());
I set them again in the MappingCouchbaseConverter constructor so that the mappingContext could capture the SimpleTypes so those converters would be used.
btw - these aren't strictly user-supplied "custom" conversions. These are provided/required by couchbase (and also included in any customer-created CouchbaseCustomConversions).
Maybe the issue is with the MappingCouchbaseConverter constructors - there is no constructor that takes a CouchbaseCustomConverters parameter, therefore the caller cannot capture the SimpleTypes of the CouchbaseCustomsConverts object to populate the mappingContext.
return converters; | ||
} | ||
|
||
@WritingConverter public enum UuidToString implements Converter<UUID,String> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please properly format this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Fixed in next push.
Optional<BasicCouchbasePersistentEntity<?>> entity = null; | ||
try { | ||
entity = super.addPersistentEntity(typeInformation); | ||
} catch (Exception ioe) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That try/catch block shouldn't be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I've changed the test case that is expecting MappingException to also expect IllegalObjectAccessException.
…:spring-projects/spring-data-couchbase into datacouch_1057_illegal_reflective_access
abbc1e0
to
ec4e237
Compare
dead636
to
93fa907
Compare
…:spring-projects/spring-data-couchbase into datacouch_1057_illegal_reflective_access
93fa907
to
c0beb13
Compare
target 9 is necessary to support module info. module info is necessary to specify the various requires/opens/exports.
Converters for BigInteger and UUID have been added in OtherConverters.
The constructor for MappingCouchbaseConverter has been modified to (1) include the CouchbaseCustomConverters; and (2) specify the SimpleTypes of the converters. Prior to this change, couchbaseMappingContext Bean and mappingCouchbaseConverter Bean in AbstractCouchbaseConfiguration were relied upon for doing this.
Closes #1057.